package com.br.aiops.listeners;

import com.br.aiops.alert.AlertSender;
import com.br.aiops.events.CountEvent;
import com.br.aiops.schedule.AbstractSchedule;
import com.br.aiops.schedule.Schedules;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

@Component
public abstract class AbstractListener {

    @Autowired
    protected AlertSender alertSender;

    @Autowired
    private Schedules schedules;

    protected Lock lock = new ReentrantLock();

    protected abstract void handlerEvent(CountEvent event);

    public AbstractSchedule getSchedule(int duration) {
        return schedules.getSchedule(duration);
    }
}
